this._list.connect('actor-added', Lang.bind(this, this._sync));
this._list.connect('actor-removed', Lang.bind(this, this._sync));
+ let id = Main.sessionMode.connect('updated',
+ Lang.bind(this, this._sync));
+ this.actor.connect('destroy', function() {
+ Main.sessionMode.disconnect(id);
+ });
+
this._messages = new Map();
this._date = new Date();
this.empty = true;
this.emit('key-focus-in', actor);
},
+ get allowed() {
+ return true;
+ },
+
setDate: function(date) {
if (_sameDay(date, this._date))
return;
return _sameDay(this._date, today);
},
- _syncVisible: function() {
- this.actor.visible = !this.empty;
+ _shouldShow: function() {
+ return !this.empty;
},
_sync: function() {
this.emit('empty-changed');
this._closeButton.visible = this._canClear();
- this._syncVisible();
+ this.actor.visible = this.allowed && this._shouldShow();
}
});
Signals.addSignalMethods(MessageListSection.prototype);
this._eventSource.connect('changed', Lang.bind(this, this._reloadEvents));
},
+ get allowed() {
+ return Main.sessionMode.showCalendarEvents;
+ },
+
_updateTitle: function() {
let now = new Date();
if (_sameDay(this._date, now)) {
this._reloadEvents();
},
- _syncVisible: function() {
- this.actor.visible = !this.empty || !this._isToday();
+ _shouldShow: function() {
+ return !this.empty || !this._isToday();
},
_sync: function() {
}));
this.actor.connect('notify::mapped', Lang.bind(this, this._onMapped));
+ },
- Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated));
- this._sessionUpdated();
+ get allowed() {
+ return Main.sessionMode.hasNotifications &&
+ !Main.sessionMode.isGreeter;
},
_sourceAdded: function(tray, source) {
app.activate();
},
- _syncVisible: function() {
- this.actor.visible = !this.empty && this._isToday();
+ _shouldShow: function() {
+ return !this.empty && this._isToday();
},
- _sessionUpdated: function() {
+ _sync: function() {
+ this.parent();
this._title.reactive = Main.sessionMode.allowSettings;
}
});